{include file="Public:header"/}
        <link rel="stylesheet" href="/static/style/cart.css" type="text/css">

	<script type="text/javascript" src="/static/js/cart1.js"></script>	

	<div style="clear:both;"></div>
	
	<!-- 页面头部 start -->
	<div class="header w990 bc mt15">
		<div class="logo w990">
			<h2 class="fl"><a href="{:url('/home/index/index')}"><img src="/static/images/logo.png" alt="京西商城"></a></h2>
			<div class="flow fr">
				<ul>
					<li class="cur">1.我的购物车</li>
					<li>2.填写核对订单信息</li>
					<li>3.成功提交订单</li>
				</ul>
			</div>
		</div>
	</div>
	<!-- 页面头部 end -->
	
	<div style="clear:both;"></div>

	<!-- 主体部分 start -->
	<div class="mycart w990 mt10 bc">
		<h2><span>我的购物车</span></h2>
		<table>
			<thead>
				<tr>
					<th class="col1">商品名称</th>
					<th class="col2">商品信息</th>
					<th class="col3">单价</th>
					<th class="col4">数量</th>	
					<th class="col5">小计</th>
					<th class="col6">操作</th>
				</tr>
			</thead>
			<tbody>
				
                                {volist name='data' id='v'}
				<tr>
                                    <td class="col1"><a href="{:url('home/goods/detail',['goods_id'=>$v.c_goods_id])}"><img src="{$v.c_goods_img}" alt="" /> <strong>【1111购物狂欢节】{$v.c_goods_name}</strong></a></td>
					<td class="col2"> <p>颜色：0922红棕现货</p> <p>尺码：40现货</p></td>
					<td class="col3">￥<span>{$v.c_goods_price}</span></td>
					<td class="col4"> 
                                            <a href="javascript:;" onclick="reduce({$v.c_id})" class="reduce_num"></a>
                                            <input  onchange="fn(this,{$v.c_id})" type="text" name="c_goods_number" value="{$v.c_goods_number}" id='{$v.c_id}' class="amount"/>
						<a href="javascript:;" onclick="add({$v.c_id})" class="add_num"></a>
					</td>
					<td class="col5">￥<span>{$v.c_price}.00</span></td>
                                        <td class="col6"><a href="{:url('home/flow/del',['id'=>$v.c_id])}">删除</a></td>
				</tr>
                                {/volist}
			</tbody>
			<tfoot>
				<tr>
					<td colspan="6">购物金额总计： <strong>￥ <span id="total">{$allprice}</span></strong></td>
				</tr>
			</tfoot>
		</table>
		<div class="cart_btn w990 bc mt10">
			<a href="{:url('home/goods/goodsList')}" class="continue">继续购物</a>
			<a href="{:url('home/flow/jiesuan')}" class="checkout">结 算</a>
		</div>
	</div>
	<!-- 主体部分 end -->

	<div style="clear:both;"></div>
	<!-- 底部版权 start -->
	<div class="footer w1210 bc mt15">
		<p class="links">
			<a href="">关于我们</a> |
			<a href="">联系我们</a> |
			<a href="">人才招聘</a> |
			<a href="">商家入驻</a> |
			<a href="">千寻网</a> |
			<a href="">奢侈品网</a> |
			<a href="">广告服务</a> |
			<a href="">移动终端</a> |
			<a href="">友情链接</a> |
			<a href="">销售联盟</a> |
			<a href="">京西论坛</a>
		</p>
		<p class="copyright">
			 © 2005-2013 京东网上商城 版权所有，并保留所有权利。  ICP备案证书号:京ICP证070359号 
		</p>
		<p class="auth">
			<a href=""><img src="/static/images/xin.png" alt="" /></a>
			<a href=""><img src="/static/images/kexin.jpg" alt="" /></a>
			<a href=""><img src="/static/images/police.jpg" alt="" /></a>
			<a href=""><img src="/static/images/beian.gif" alt="" /></a>
		</p>
	</div>
	<!-- 底部版权 end -->
</body>
</html>
<script>
    function reduce(id){
        var xml = new XMLHttpRequest();
    var number = document.getElementById(id).value;
        var c_goods_id = '?c_id='+id;
        var string =c_goods_id+'&c_goods_number='+number;
    //对特殊符号进行编码处理
//    number = encodeURIComponent(number);
     //获取状态
//   xml.onreadystatechange = function(){
//       console.log(xml.readyState);
//       if(xml.readyState==4){
//           document.getElementById('requ').innerHTML = xml.responseText;
//        alert(xml.responseText);
//   }
//   }

     xml.open('get',"{:url('home/flow/reduce')}"+string);

     //发送请求
     xml.send(null); 
    }
   
   function add(id){
        var xml = new XMLHttpRequest();
    var number = document.getElementById(id).value;
        var c_goods_id = '?c_id='+id;
        var string =c_goods_id+'&c_goods_number='+number;
    //对特殊符号进行编码处理
//    number = encodeURIComponent(number);
     //获取状态
   xml.onreadystatechange = function(){
       console.log(xml.readyState);
       if(xml.readyState==4){
//           document.getElementById('requ').innerHTML = xml.responseText;
           if(null!=xml.responseText && ''!=xml.responseText){
               document.getElementById(id).value = xml.responseText;
             alert('商品数量不足!');
           }
   }
   }

     xml.open('get',"{:url('home/flow/add')}"+string);

     //发送请求
     xml.send(null); 
    }
    function fn(obj,id){
        var xml = new XMLHttpRequest();
    var number = document.getElementById(id).value;
        var c_goods_id = '?c_id='+id;
        var string =c_goods_id+'&c_goods_number='+number;
    //对特殊符号进行编码处理
//    number = encodeURIComponent(number);
     //获取状态
   xml.onreadystatechange = function(){
       console.log(xml.readyState);
       if(xml.readyState==4){
//           document.getElementById('requ').innerHTML = xml.responseText;
           if(null!=xml.responseText && ''!=xml.responseText){
             document.getElementById(id).value = xml.responseText;
             alert('商品数量不足!');
           }
   }
   }

     xml.open('get',"{:url('home/flow/change')}"+string);

     //发送请求
     xml.send(null); 
    }
</script>